//
//  MyOperation.m
//  NSOperationTest
//
//  Created by wangrui on 13-8-23.
//  Copyright (c) 2013年 PPS. All rights reserved.
//

#import "MyOperation.h"


@implementation MyOperation
@synthesize index;

/*
 * 重写start后,不自动调用main
 **/
- (void)start{
    NSLog(@"operation %d start,%@",index,[NSThread currentThread]);
   // [self main];
}

- (void)cancel{
    NSLog(@"operation %d cancel",index);
}

- (void)main{
    NSLog(@"operation %d main,%@",index,[NSThread currentThread]);
}


/*
 *非并发的operation需要operationqueue提供线程来达到并发目的
 *并发的operation,可以自己并发,直接调用start即可，不用加入队列。重写start的方法，并自己开一个线程执行main
 */
- (BOOL)isConcurrent {
    return YES;
}

@end
